import json

json_file = open("responsibility\chat-export-1755569405473.json", "r", encoding="utf-8")

json_data = json.load(json_file)

messages = json_data[0]['chat']['messages']

with open("responsibility\chat-export-1755569405473.md", "w", encoding="utf-8") as f:
    for message in messages:
        role = message['role']
        if role == 'user':
            print(f"{role}：{message['content']}")
            f.write(f"## {message['content']}\n")
        else:
            assistants = message['content_list']
            for assistant in assistants:
                print(f"{role}：{assistant['content']}")
                f.write(f"{role}：{assistant['content']}\n")
    

json_file.close()